package cn.bugstack.infrastructure.dao;

import cn.bugstack.infrastructure.dao.po.RaffleActivityAccount;
import cn.bugstack.middleware.db.router.annotation.DBRouter;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author 19872
 * 抽奖活动账户表Dao
 */
@Mapper
public interface IRaffleActivityAccountDao {

    @DBRouter(key = "userId")
    int updateAccountQuota(RaffleActivityAccount raffleActivityAccount);

    @DBRouter(key = "userId")
    void insert(RaffleActivityAccount raffleActivityAccount);

    /**
     * 查询抽奖活动账户表
     * @param raffleActivityAccountReq 抽奖活动账户表对象
     * @return 抽奖活动账户表对象
     */
    @DBRouter(key = "userId")
    RaffleActivityAccount queryActivityAccountByUserId(RaffleActivityAccount raffleActivityAccountReq);

    /**
     * 更新抽奖活动账户表
     * @param raffleActivityAccountReq 抽奖活动账户表对象
     * @return 更新的行数
     */
    @DBRouter(key = "userId")
    int updateActivityAccountSubstractionQuota(RaffleActivityAccount raffleActivityAccountReq);

    /**
     * 更新抽奖活动账户表的镜像月剩余额度
     * @param raffleActivityAccountReq 抽奖活动账户表对象
     */
    @DBRouter(key = "userId")
    void updateActivityAccountMonthSurplusImageQuota(RaffleActivityAccount raffleActivityAccountReq);

    /**
     * 更新抽奖活动账户表的镜像日剩余额度
     * @param raffleActivityAccountReq 抽奖活动账户表对象
     */
    @DBRouter(key = "userId")
    void updateActivityAccountDaySurplusImageQuota(RaffleActivityAccount raffleActivityAccountReq);

    /**
     * 查询活动账户实体
     * @param raffleActivityAccountReq 抽奖活动账户查询对象
     * @return 活动账户实体
     */
    @DBRouter(key = "userId")
    RaffleActivityAccount queryActivityAccountEntity(RaffleActivityAccount raffleActivityAccountReq);

    /**
     * 查询用户已抽奖次数
     * @param raffleActivityAccountReq 抽奖活动账户表实体对象
     * @return 用户已抽奖次数
     */
    @DBRouter(key = "userId")
    Integer queryRaffleActivityAccountPartakeCount(RaffleActivityAccount raffleActivityAccountReq);
}
